using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class AudioData : Singleton<AudioData>
{
    public event Action<float> OnVolumeChanged;
    private float audioVolumeBGM = 0.7f;
    public float GetAudioVolumeBGM{ get { return audioVolumeBGM; } }

    public void UpdateBGMVolume(float volume)
    {
        audioVolumeBGM = volume;
        UpdateInfo();
    }
    private float audioVolumeSFX = 0.7f;
    public float GetAudioVolumeSFX { get { return audioVolumeSFX; } set { audioVolumeSFX = value; } }


    public void AddListener(Action<float> callback)
    {
        OnVolumeChanged += callback;
    }

    public void RemoveListener(Action<float> callback)
    {
        OnVolumeChanged -= callback;
    }

    public void UpdateInfo()
    {
        OnVolumeChanged?.Invoke(audioVolumeBGM);
    }
}
